package com.tmptSource.controller.taglib;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import com.tmptSource.service.intf.IOwOffpostRecordService;
import org.json.JSONObject;
import com.google.gson.Gson;
import com.tmptSource.enums.*;

public class OwOffpostRecordTag {

	private Logger log = Logger.getLogger(this.getClass());
	
	@Resource(name="pageContext") private PageContext pageContext;
	@Resource(name="owOffpostRecordService") private IOwOffpostRecordService owOffpostRecordService;


    /**
    * 页面上查询列的值，动态加载，sql语句读数据库配置而来
    * when column.dataResource==2
    */
    public Map<String,Object> select4a2userId(){
		Map<String,Object> mapReturn = new HashMap<String,Object>();
    	List<Map> list = owOffpostRecordService.select4a2userId();

    	//查询条件中动态数据
        List<Map> listCopy = new ArrayList<Map>();
        listCopy.addAll(list);
        Map map = new HashMap();
        map.put("keyName","");
        map.put("valueName","全部");
        listCopy.add(0, map);
        mapReturn.put("list4condition",listCopy);

        //添加编辑Dialog中，动态取数据（optionsql字段处理）
        JSONArray jsonArrayProperty = new JSONArray();
        for(Map map1: list){
        JSONObject jo = new JSONObject();
        jo.put("keyName",map1.get("keyName"));
        jo.put("valueName",map1.get("valueName"));
        jsonArrayProperty.put(jo);
        }
        mapReturn.put("jsonStr4addDialog",jsonArrayProperty.toString());

        return mapReturn;
	}


    /**
    * 数据字典中加载数据信息
    * when column.dataResource==1,4
    * @return
    */
    public Map<String,Object> getEnumColumnSelfData(){
        Map<String,Object> mapReturn = new HashMap<String, Object>();
        Gson gson = new Gson();

        //查询条件中动态数据
        Map map = null;


        //添加编辑Dialog中，动态取数据（数据字典）
        String str = "";

        return mapReturn;
    }

}
